import {connect} from 'react-redux'
import React, {Component} from 'react'
import { List } from 'antd-mobile';
const Item = List.Item;
const Brief = Item.Brief;

import Header from "../components/header";

import FooterMenu from "../components/footerMenu";

import OpenStyle from "../components/openStyle/openStyle"
import OpenLK28Style from "../components/openStyle/openLK28Style"

import  {LoadAwardCenter} from "../redux/actions/awardAction"
export class Awardcontaniner extends Component {
  constructor (props){
   super(props)
   this.state= {
   }
}

    componentWillMount(){
        const {dispatch} = this.props
        dispatch(LoadAwardCenter())
    }

   render() {
    //    console.log(this.props.award.get("awardcenter"),"awardcontainer");
       let awardlist = this.props.award.get("awardcenter")
      return <div>
          <Header title="开奖中心" isIndex={true}></Header>
          <div className="container">
    <List className="my-list">
        {  awardlist.length == 0 ?  <div className="loading-box"><div className="loading-start">
       </div><p className="msg">数据加载中···</p></div> :
            awardlist.map((ListItem, index) => {
            return  <Item key={index}
            arrow="horizontal"
            thumb={"/static/images/ICON_"+ ListItem.gameCode +".png"}
            multipleLine
            onClick={() => {
                this.props.history.push('/award/'+ListItem.gameCode)
            }}
        >
            <div className="title">
            <h4>{ListItem.gameName}</h4> <span>第{ListItem.qs}期</span><span>{ListItem.openTime}</span>
            </div>
            <Brief>
            {
            ListItem.gameCode !== "BJKL8" ?
                    <OpenStyle code={ListItem.openCode} gameCode={ListItem.gameCode}></OpenStyle> : <OpenLK28Style code={ListItem.openCode}></OpenLK28Style>
            }
            </Brief>
        </Item>
        })}
    </List>
    </div>
          <FooterMenu></FooterMenu>
      </div>
   }
}

function mapStateToProps(state) {
  return {
    award: state.award
  }
}

export default connect(mapStateToProps)(Awardcontaniner)